package com.hackaton.maps.transport;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.*;
import com.hackaton.R;

/**
 * Created with IntelliJ IDEA.
 * User: Ivan
 * Date: 20.10.13
 * Time: 1:07
 * To change this template use File | Settings | File Templates.
 */
public class Station {
    public LatLng position;
    public String address = "default address";
    public int pointIndex;
    public Route route;

    private GroundOverlay overlay;

    public Station(LatLng position, Route route) {
        this.position = position;
        this.route = route;
    }

    public void draw(GoogleMap map) {
        overlay = map.addGroundOverlay(new GroundOverlayOptions().position(position, 20)
                .image(getIcId()));

        // map.addCircle(new CircleOptions().center(position).radius(10).fillColor(0x9933AA33));
    }

    private BitmapDescriptor getIcId() {
        int id = -1;
        if (route.getTransportType().equals(TransportType.taxi))
            id = R.drawable.ic_map_taxi;
        if (route.getTransportType().equals(TransportType.trol))
            id =  R.drawable.ic_map_trol;
        if (route.getTransportType().equals(TransportType.tram))
            id =  R.drawable.ic_map_tram;

        if (id != -1)
            return BitmapDescriptorFactory.fromResource(id);

        return null;
    }

    public void setVisible(boolean visible) {
        overlay.setVisible(visible);
    }
}
